﻿////页面加载
$(document).ready(function () {
    $("#fmSave").bind("submit", btnSave_click);
    $("#btnSeaarch").bind("click", btnSeaarch_click);
})

function btnSave_click() {

    var v_password = $("#Password").val();
    if (v_password == "") {
        alert("请输入密码！");
        return false;
    }

    var v_Buyer_Phone = $("#Buyer_Phone").val();
    if (v_Buyer_Phone == "") {
        alert("请输入电话，方便联系！");
        return false;
    }

    if (confirm("您确定支付该订单？")) {
        // 异步提交表单,表单中input元素必须设置name 属性
        //$.post("/WeiXin/PayBill", $("#fmSave").serialize(), function (result) {
        //});
        //$.post("/WeiXin/PayBill", $("#fmSave").serialize(), function (result) {
        //    window.location.href = "/WeiXin/PayResult";
        //});
        return true;

    }
    else {
        return false;
    }

}

function btnSeaarch_click() {
    var v_CardID = $("#search").val();
    if (v_CardID == "") {
        alert("请输入会员卡号");
        return;
    }
    $.post("/WeiXin/GetMyOrder", { cardCode: v_CardID }, function (result) {
        $("#olOrder").empty();
        $.each(result.data, function (i, item) {
           
            var li = " <li><a href='#'><h2>订单编号：<span id='order_Code'>" + item.Code + "</span>&nbsp;&nbsp;&nbsp;&nbsp;订单总金额：<span id='order_total'>" + item.Total + "</span>元</h2></a></li>";
            $("#olOrder").append(li);            
        });
        //绑定卡号
        $("#Buyer").val(v_CardID);
        $("#olOrder").listview('refresh'); // 刷新
    }, "json");

    
}
